import request from '@/utils/request'

// 获取销售的基础数据
export function getBasicSaleData() {
    return request({
      url: '/dashboard/sale/base',
      method: 'post',
    })
  }
  // 获取退货的基础数据
export function getRefundData() {
  return request({
    url: '/dashboard/refund/base',
    method: 'post',
  })
}
  // 获取某年某类别每个月的销售额
  export function getCategorySaleData(data) {
    return request({
      url: '/dashboard/sale/category/month/turnover?year='+data,
      method: 'post',
    })
  }

  // 获取优惠订单率
  export function getPromotionRate() {
    return request({
      url: '/dashboard/promotion/base',
      method: 'post',
    })
  }
  // 获取某年每个月的销售额
  export function getMonthlySaleData(data) {
    return request({
      url: '/dashboard/sale/month/turnover?year='+data,
      method: 'post',
    })
  }
  // 获取某年每个月的订单量
  export function getMonthlyOrderData(data) {
    return request({
      url: '/dashboard/sale/month/count?year='+data,
      method: 'post',
    })
  }
  // 获取每月产品退货率前5
  export function getReturnProductData() {
    return request({
      url: '/dashboard/refund/product',
      method: 'post',
    })
  }
  // 获取每年退货原因
  export function getReturnReasonData(data) {
    return request({
      url: '/dashboard/refund/reason?year='+data,
      method: 'post',
    })
  }
  // 获取优惠使用次数的统计数据
  export function getPromotionTimeData(year,month) {
    return request({
      url: '/dashboard/promotion/count?year='+year+'&month=' + month,
      method: 'post',
    })
  }
  // 获取某年月平均优惠额
  export function getMonthlyPromotionAmount(data) {
    return request({
      url: '/dashboard/promotion/amount?year='+data,
      method: 'post',
    })
  }
  // 获取某年退货单量
  export function getReturnCount(data) {
    return request({
      url: '/dashboard/refund/month/count?year='+data,
      method: 'post',
    })
  }


  // 获取各产品销售额
  export function getProductSaleDate(year,seq) {
    return request({
      url: '/dashboard/sale/product?year='+year+'&seq='+seq,
      method: 'post',
    })
  }
    // 获取有销售数据的年份
  export function getAvaliableDate() {
    return request({
      url: '/dashboard/sale/year',
      method: 'post',
    })
  }

  // 获取有销售数据的年月
  export function getAvaliableTime() {
    return request({
      url: '/dashboard/sale/time',
      method: 'post',
    })
  }

  // 获取支付方式比例
  export function getPayTypeRate() {
    return request({
      url: '/dashboard/pay/type',
      method: 'post',
    })
  }